package model.role
{
	public class RoleModel
	{
		private var roleDatas:Array;
		
		public function RoleModel()
		{
			init();
		}
		
		private function init():void
		{
			roleDatas = [];
		}
		
		public function addRoleData(roleData:IRoleData):void
		{
			roleDatas.push(roleData);
		}
		
		public function removeRoleDataBySitId(sitId:int):void
		{
			var roleData:IRoleData;
			for (var i:int=0;i<roleDatas.length; i++)
			{
				roleData = roleDatas[i];
				if (roleData.sitId == sitId)
				{
					roleDatas.splice(i,1);		
				}
			}	
			
		}
		
		public function getRoleDataBySitId(sitId:int):IRoleData
		{
			var roleData:IRoleData;
			for (var i:String in roleDatas)
			{
				roleData = roleDatas[i];
				if (roleData.sitId == sitId)
				{
					return roleData;
				}
			}	
			return null;
		}
		
		public function clear():void
		{
			roleDatas.length = 0;
		}
	}
}